// praxis/hardware/simulated_sensor.h
#pragma once

#include <memory>

#include "praxis/hardware/isensor.h"

namespace praxis {
// Forward declaration is sufficient here.
class IActuator;

class PRAXIS_API CSimulatedSensor : public ISensor {
 public:
  CSimulatedSensor(const std::string& name, const std::string& unit,
                   double initial_value, double noise_amplitude);

  const std::string& GetName() const override;
  void Update() override;
  nlohmann::json GetValueAsJson() const override;

  // Establishes a simulated physical link to an actuator.
  void LinkToActuator(std::shared_ptr<IActuator> actuator, double influence);

 private:
  std::string name_;
  std::string unit_;
  double current_value_;
  double noise_amplitude_;

  std::shared_ptr<IActuator> linked_actuator_ = nullptr;
  double actuator_influence_ = 0.0;
  double base_value_;  // Ambient or default value
};
}  // namespace praxis
